import request from "../utils/request";

export function getSpuList({ page, limit, category3Id }) {
  return request({
    method: "get",
    url: `/admin/product/${page}/${limit}`,
    params: {
      category3Id
    }
  });
}

export function getAttrList() {
  return request({
    method: "get",
    url: "/admin/product/baseTrademark/getTrademarkList"
  });
}

export function baseSaleList() {
  return request({
    method: "get",
    url: "/admin/product/baseSaleAttrList"
  });
}

//添加销售属性
export function setSaleList(data) {
  return request({
    method: "post",
    url: "/admin/product/saveSpuInfo",
    data
  });
}

//获取基础属性
export function getSpuSale(spuId) {
  return request({
    method: "get",
    url: `/admin/product/getSpuById/${spuId}`
  });
}

//删除spu
export function delSpuSale(spuId) {
  return request({
    method: "delete",
    url: `/admin/product/deleteSpu/${spuId}`
  });
}


//获取图片列表
export function getImageList(spuId) {
  return request({
    method: "get",
    url: `/admin/product/spuImageList/${spuId}`
  });
}

//获取销售属性值列表
export function getSpuSaleList(spuId) {
  return request({
    method: "get",
    url: `/admin/product/spuSaleAttrList/${spuId}`
  });
}
//获取平台属性值列表
export function getInfoList({ category1Id, category2Id, category3Id }) {
  return request({
    method: "get",
    url: `/admin/product/attrInfoList/${category1Id}/${category2Id}/${category3Id}`
  });
}

//确认添加Spu
export function addSpuSale(data) {
  return request({
    method: "post",
    url: "/admin/product/saveSkuInfo",
    data
  });
}
